using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Insecure_ForgotUsername : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        txtEMailAddress.Focus();

    }
    protected void btnFindUserName_Click(object sender, EventArgs e)
    {
        //MembershipUser user = null;
        string username = string.Empty;

        lblResults.Text = string.Empty;

        if (txtEMailAddress.Text != String.Empty)
        {
            username = Membership.GetUserNameByEmail(txtEMailAddress.Text);
            if ( username != null) 
            {
                lblResults.Text = "Your Username is  " + username;
            }
            else
            {
                lblResults.Text = "Email Address not found.";
            }
        }
        else
        {
            lblResults.Text = "You must enter an Email Address.";
        }
    }
}
